<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" href="../../css/api.css" />
    <link rel="stylesheet" href="../../css/common.css" />
</head>

<body>
    <header class="yt-header">
        <h1 class="yt-header-title">视频</h1>
    </header>
    <section class="content">
        <button class="button block" onclick="playVideo('8200')">播放8200视频</button>
        <button class="button block" onclick="playVideo('HMD')">播放和目的视频</button>
        <div class="resault">

        </div>
    </section>
</body>
<script src="../../script/api.js"></script>
<script>
    // 是否在真是设备上运行
    var deviceReady = false
        // 8200 视频地址
    var videoPath_8200 = 'http://180.104.97.240:83/pag/10.252.62.2/7302/00000000001310017124/0/MAIN/TCP/live.m3u8'
        // 和目的 视频地址
    var videoPath_HMD = 'http://223.111.192.83:8100/stream/channels/6f0ff7bbe09d4818813cd3d319d386e9/sub'
        // 8700 视频地址
    var videoPath_8700 = ''

    apiready = function() {
        deviceReady = true
    }

    function playVideo(type) {
        if (!deviceReady) {
            alert('apiready is false')
            return
        }

        var videoPath = ''
        if (type === '8200') {
          videoPath = videoPath_8200
          alert(videoPath)

          api.openVideo({
              url: videoPath
          })
          return
        }
        if (type === 'HMD') {
          videoPath = videoPath_HMD
          alert(videoPath)

          api.openWin({
              name: 'video',
              url: './play.html',
              rect: {
                  x: 0,
                  y: 0,
                  w: 'auto',
                  h: 'auto',
                  marginLeft: 0,
                  marginTop: 0,
                  marginBottom: 0,
                  marginRight: 0
              },
              pageParam: {
                  videoPath: videoPath
              },
              useWKWebView: true,
              bounces: false,
              bgColor: 'rgba(0,0,0,1)'
          })
        }
    }
</script>

</html>
